package dd.view;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JTextField;


import dd.control.RequestCreateEventController;

public class CreateForm extends JFrame {

	JPanel contentPane;
	JTextField eventNameField;
	JComboBox typeComboBox;
	JComboBox modeComboBox;
	
	public static final String mode_open = "Open";
	public static final String mode_closed = "Closed";
	
	public static final String type_rr = "Round Robin";
	public static final String type_async = "Asynchronous";
	 JTextField txtFMaxChoices;
	 JTextField txtFMaxEdges;

	/**
	 * Create the frame.
	 */
	public CreateForm() {
		setTitle("CreateEvent Form");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblMode = new JLabel("Mode");
		lblMode.setBounds(19, 32, 61, 16);
		contentPane.add(lblMode);
		
		modeComboBox = new JComboBox(new Object[] { mode_open, mode_closed });
		modeComboBox.setBounds(78, 28, 271, 27);
		contentPane.add(modeComboBox);
		
		JLabel lblType = new JLabel("Type");
		lblType.setBounds(19, 77, 61, 16);
		contentPane.add(lblType);
		
		typeComboBox = new JComboBox(new Object[] { type_rr, type_async});
		typeComboBox.setBounds(78, 73, 271, 27);
		contentPane.add(typeComboBox);
		
		JButton btnCreate = new JButton("Create");
		btnCreate.setBounds(327, 243, 117, 29);
		contentPane.add(btnCreate);
		
		btnCreate.addActionListener(new RequestCreateEventController(this));
	//	btnCreate.addActionListener(new CreateEventButtonController(this));
		eventNameField = new JTextField();
		eventNameField.setBounds(78, 185, 271, 28);
		contentPane.add(eventNameField);
		eventNameField.setColumns(10);
		
		JLabel lblName = new JLabel("Name");
		lblName.setBounds(13, 190, 61, 16);
		contentPane.add(lblName);
		
		JLabel lblNewLabel = new JLabel("Max Choices");
		lblNewLabel.setBounds(0, 117, 85, 15);
		contentPane.add(lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("Max Edges");
		lblNewLabel_1.setBounds(0, 155, 70, 15);
		contentPane.add(lblNewLabel_1);
		
		txtFMaxChoices = new JTextField();
		txtFMaxChoices.setBounds(78, 111, 271, 27);
		contentPane.add(txtFMaxChoices);
		txtFMaxChoices.setColumns(10);
		
		txtFMaxEdges = new JTextField();
		txtFMaxEdges.setBounds(78, 148, 271, 27);
		contentPane.add(txtFMaxEdges);
		txtFMaxEdges.setColumns(10);
	}
	
	public JComboBox getModeComboBox() {
		return modeComboBox;
	}
	
	public JComboBox getTypeComboBox() {
		return typeComboBox;
	}
	public JTextField getMaxChoicesTxtF() {
		return txtFMaxChoices;
	}
	public JTextField getMaxEdgesTxtF() {
		return txtFMaxEdges;
	}
	public JTextField getNameTxtF() {
		return eventNameField;
	}
}
